#include "header/pyramid_room2.h"

OSG_USING_NAMESPACE

double room2_height = 120;
double room2_width = 250;
double room2_depth = 300;
double room2_door_height = 90;
double room2_door_width = 70;

NodePtr createRoom2()
{
	Matrix m;



#ifdef ROOM2_PLANES_ON
	// *********** FrontL ***********
	NodePtr frontL = makePlane(room2_width/2-room2_door_width/2, room2_height, 50, 50);
	
	TransformPtr tfrontL = Transform::create();
	beginEditCP(tfrontL, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate((room2_width/2-room2_door_width/2)/2, room2_height/2, room2_depth);
		m.setRotate(Quaternion(Vec3f(0,1,0), M_PI));
		tfrontL->setMatrix(m);
	endEditCP(tfrontL, Transform::MatrixFieldMask);
	
	NodePtr frontLTrans = Node::create();
	beginEditCP(frontLTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		frontLTrans->setCore(tfrontL);
		frontLTrans->addChild(frontL);
	endEditCP(frontLTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	//Kammer Boden Texturen laden
	ImagePtr cryptWallLeftImage = Image::create();
   cryptWallLeftImage->read("materials/Room_Door1_Left.jpg");    
	    
	    
	//Aus dem Bild eine Textur machen
	TextureChunkPtr cryptWallLeftTex = TextureChunk::create();
	beginEditCP(cryptWallLeftTex);
		cryptWallLeftTex->setImage(cryptWallLeftImage);
		cryptWallLeftTex->setMinFilter(GL_LINEAR);
		cryptWallLeftTex->setMagFilter(GL_LINEAR);
		cryptWallLeftTex->setWrapS(GL_REPEAT);
		cryptWallLeftTex->setWrapT(GL_REPEAT);
		cryptWallLeftTex->setEnvMode(GL_MODULATE);
	endEditCP(cryptWallLeftTex);
	  
	SimpleMaterialPtr cryptWallLeftMat = SimpleMaterial::create();
	beginEditCP(cryptWallLeftMat);
		//Materialfarbe bei seitlicher Ansicht (Brechungswinkel)
		cryptWallLeftMat->setAmbient(Color3f(0.3, 0.3, 0.5));    
		//Bestimmt Farbe des Materials
		cryptWallLeftMat->setDiffuse(Color3f(1.0, 1.0, 1.0));
		cryptWallLeftMat->setSpecular(Color3f(0.1, 0.1, 0.2));
		cryptWallLeftMat->addChunk(cryptWallLeftTex);
	endEditCP(cryptWallLeftMat);

	
	GeometryPtr cryptWallLeftGeo = GeometryPtr::dcast(frontL->getCore());
	beginEditCP(cryptWallLeftGeo);
		cryptWallLeftGeo->setMaterial(cryptWallLeftMat);
	endEditCP(cryptWallLeftGeo);
	
	
	// *********** FrontR ***********
	NodePtr frontR = makePlane(room2_width/2-room2_door_width/2, room2_height, 50, 50);
	
	TransformPtr tfrontR = Transform::create();
	beginEditCP(tfrontR, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width-(room2_width/2-room2_door_width/2)/2, room2_height/2, room2_depth);
		m.setRotate(Quaternion(Vec3f(0,1,0), M_PI));
		tfrontR->setMatrix(m);
	endEditCP(tfrontR, Transform::MatrixFieldMask);
	
	NodePtr frontRTrans = Node::create();
	beginEditCP(frontRTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		frontRTrans->setCore(tfrontR);
		frontRTrans->addChild(frontR);
	endEditCP(frontRTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	//Kammer Boden Texturen laden
	ImagePtr cryptWallRightImage = Image::create();
   cryptWallRightImage->read("materials/Room_Door1_Right.jpg");    
	    
	    
	//Aus dem Bild eine Textur machen
	TextureChunkPtr cryptWallRightTex = TextureChunk::create();
	beginEditCP(cryptWallRightTex);
		cryptWallRightTex->setImage(cryptWallRightImage);
		cryptWallRightTex->setMinFilter(GL_LINEAR);
		cryptWallRightTex->setMagFilter(GL_LINEAR);
		cryptWallRightTex->setWrapS(GL_REPEAT);
		cryptWallRightTex->setWrapT(GL_REPEAT);
		cryptWallRightTex->setEnvMode(GL_MODULATE);
	endEditCP(cryptWallRightTex);
	  
	SimpleMaterialPtr cryptWallRightMat = SimpleMaterial::create();
	beginEditCP(cryptWallRightMat);
		//Materialfarbe bei seitlicher Ansicht (Brechungswinkel)
		cryptWallRightMat->setAmbient(Color3f(0.3, 0.3, 0.5));    
		//Bestimmt Farbe des Materials
		cryptWallRightMat->setDiffuse(Color3f(1.0, 1.0, 1.0));
		cryptWallRightMat->setSpecular(Color3f(0.1, 0.1, 0.2));
		cryptWallRightMat->addChunk(cryptWallRightTex);
	endEditCP(cryptWallRightMat);

	
	GeometryPtr cryptWallRightGeo = GeometryPtr::dcast(frontR->getCore());
	beginEditCP(cryptWallRightGeo);
		cryptWallRightGeo->setMaterial(cryptWallRightMat);
	endEditCP(cryptWallRightGeo);
	
	
	// *********** FrontM ***********
	NodePtr frontM = makePlane(room2_door_width+1/4, room2_height-room2_door_height, 50, 50);
	
	TransformPtr tfrontM = Transform::create();
	beginEditCP(tfrontM, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width/2-1/8, room2_door_height+(room2_height-room2_door_height)/2, room2_depth);
		m.setRotate(Quaternion(Vec3f(0,1,0), M_PI));
		tfrontM->setMatrix(m);
	endEditCP(tfrontM, Transform::MatrixFieldMask);
	
	NodePtr frontMTrans = Node::create();
	beginEditCP(frontMTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		frontMTrans->setCore(tfrontM);
		frontMTrans->addChild(frontM);
	endEditCP(frontMTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	//Kammer Boden Texturen laden
	ImagePtr cryptWallMiddleImage = Image::create();
   cryptWallMiddleImage->read("materials/Room_Door1_Middle.jpg");    
	    
	    
	//Aus dem Bild eine Textur machen
	TextureChunkPtr cryptWallMiddleTex = TextureChunk::create();
	beginEditCP(cryptWallMiddleTex);
		cryptWallMiddleTex->setImage(cryptWallMiddleImage);
		cryptWallMiddleTex->setMinFilter(GL_LINEAR);
		cryptWallMiddleTex->setMagFilter(GL_LINEAR);
		cryptWallMiddleTex->setWrapS(GL_REPEAT);
		cryptWallMiddleTex->setWrapT(GL_REPEAT);
		cryptWallMiddleTex->setEnvMode(GL_MODULATE);
	endEditCP(cryptWallMiddleTex);
	  
	SimpleMaterialPtr cryptWallMiddleMat = SimpleMaterial::create();
	beginEditCP(cryptWallMiddleMat);
		//Materialfarbe bei seitlicher Ansicht (Brechungswinkel)
		cryptWallMiddleMat->setAmbient(Color3f(0.3, 0.3, 0.5));    
		//Bestimmt Farbe des Materials
		cryptWallMiddleMat->setDiffuse(Color3f(1.0, 1.0, 1.0));
		cryptWallMiddleMat->setSpecular(Color3f(0.1, 0.1, 0.2));
		cryptWallMiddleMat->addChunk(cryptWallMiddleTex);
	endEditCP(cryptWallMiddleMat);

	
	GeometryPtr cryptWallMiddleGeo = GeometryPtr::dcast(frontM->getCore());
	beginEditCP(cryptWallMiddleGeo);
		cryptWallMiddleGeo->setMaterial(cryptWallMiddleMat);
	endEditCP(cryptWallMiddleGeo);
	
	
	// *********** Front ***********
	NodePtr front = Node::create();
	beginEditCP(front, Node::CoreFieldMask);
	{
		front->setCore(Group::create());
		front->addChild(frontLTrans);
		front->addChild(frontRTrans);
		front->addChild(frontMTrans);
	}
	endEditCP  (front, Node::CoreFieldMask);
	
	TransformPtr tfront = Transform::create();
	beginEditCP(tfront, Transform::MatrixFieldMask);
		m.setIdentity();
		//m.setTranslate(0, 0, 0);
		//m.setRotate(Quaternion(Vec3f(1,0,0), M_PI));
		tfront->setMatrix(m);
	endEditCP(tfront, Transform::MatrixFieldMask);
	
	NodePtr frontTrans = Node::create();
	beginEditCP(frontTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		frontTrans->setCore(tfront);
		frontTrans->addChild(front);
	endEditCP(frontTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
#else
	// *********** Front ***********
	// unten
	// links
	float front_v0[3] = {0, 0, room2_depth};
	// rechts
	float front_v1[3] = {room2_width, 0, room2_depth};
	
	// oben
	// links
	float front_v2[3] = {0, room2_height, room2_depth};
	// rechts
	float front_v3[3] = {room2_width, room2_height, room2_depth};
	
	// Tuer
	// unten links
	float front_v4[3] = {room2_width/2-room2_door_width/2, 0, room2_depth};
	// oben links
	float front_v5[3] = {room2_width/2-room2_door_width/2, room2_door_height, room2_depth};
	// unten rechts
	float front_v6[3] = {room2_width/2+room2_door_width/2, 0, room2_depth};
	// oben rechts
	float front_v7[3] = {room2_width/2+room2_door_width/2, room2_door_height, room2_depth};
	
	// Definieren der benoetigten Typen
	GeoPTypesPtr frontType = GeoPTypesUI8::create();
	beginEditCP (frontType, GeoPTypesUI8::GeoPropDataFieldMask);
	{
		frontType->addValue(GL_QUADS);
	}
	endEditCP (frontType, GeoPTypesUI8::GeoPropDataFieldMask);
	
	// Anzahl der Punkte die fuer die einzelnen Typen benoetigt werden
	GeoPLengthsPtr frontLens = GeoPLengthsUI32::create();    
	beginEditCP (frontLens, GeoPLengthsUI32::GeoPropDataFieldMask);
	{
		frontLens->addValue(12);
	}
	endEditCP (frontLens, GeoPLengthsUI32::GeoPropDataFieldMask);


	// Setzen der Punkte
	GeoPositions3fPtr frontPnts = GeoPositions3f::create();
	beginEditCP (frontPnts, GeoPositions3f::GeoPropDataFieldMask);
	{
		frontPnts->addValue(Pnt3f(front_v0[0], front_v0[1], front_v0[2]));
		frontPnts->addValue(Pnt3f(front_v1[0], front_v1[1], front_v1[2]));
		frontPnts->addValue(Pnt3f(front_v2[0], front_v2[1], front_v2[2]));
		frontPnts->addValue(Pnt3f(front_v3[0], front_v3[1], front_v3[2]));
		frontPnts->addValue(Pnt3f(front_v4[0], front_v4[1], front_v4[2]));
		frontPnts->addValue(Pnt3f(front_v5[0], front_v5[1], front_v5[2]));
		frontPnts->addValue(Pnt3f(front_v6[0], front_v6[1], front_v6[2]));
		frontPnts->addValue(Pnt3f(front_v7[0], front_v7[1], front_v7[2]));
	}
	endEditCP (frontPnts, GeoPositions3f::GeoPropDataFieldMask);

	// Zusammenfuegen der Punkte in die oben angegebenen Formen
	GeoIndicesUI32Ptr frontIndices = GeoIndicesUI32::create();
	beginEditCP (frontIndices, GeoIndicesUI32::GeoPropDataFieldMask);
	{				 
		// links
		frontIndices->addValue(0);
		frontIndices->addValue(4);
		frontIndices->addValue(5);
		frontIndices->addValue(2);
		
		// mitte
		frontIndices->addValue(5);
		frontIndices->addValue(7);
		frontIndices->addValue(3);
		frontIndices->addValue(2);
		
		// rechts
		frontIndices->addValue(1);
		frontIndices->addValue(3);
		frontIndices->addValue(7);
		frontIndices->addValue(6);
		
	}
	endEditCP (frontIndices, GeoIndicesUI32::GeoPropDataFieldMask);
	
	GeoTexCoords2fPtr frontTex = GeoTexCoords2f::create();
	beginEditCP (frontTex);
	{
		frontTex->addValue(Vec2f(front_v0[0]/room2_width, front_v0[1]/room2_height));
		frontTex->addValue(Vec2f(front_v1[0]/room2_width, front_v1[1]/room2_height));

		frontTex->addValue(Vec2f(front_v2[0]/room2_width, front_v2[1]/room2_height));
		frontTex->addValue(Vec2f(front_v3[0]/room2_width, front_v3[1]/room2_height));
				  
		frontTex->addValue(Vec2f(front_v4[0]/room2_width, front_v4[1]/room2_height));
		frontTex->addValue(Vec2f(front_v5[0]/room2_width, front_v5[1]/room2_height));
		frontTex->addValue(Vec2f(front_v6[0]/room2_width, front_v6[1]/room2_height));
		frontTex->addValue(Vec2f(front_v7[0]/room2_width, front_v7[1]/room2_height));
	}
	endEditCP (frontTex);
	
	GeoNormals3fPtr frontNorms = GeoNormals3f::create();
	beginEditCP(frontNorms, GeoNormals3f::GeoPropDataFieldMask);
	{
		for (int x = 0; x < 8; x++)
			 frontNorms->addValue(Vec3f(0,0,1));
	}
	endEditCP(frontNorms, GeoNormals3f::GeoPropDataFieldMask);
	
	
	ImagePtr image = Image::create();
	image->read("materials/cryptWall.jpg");
			 
	SimpleTexturedMaterialPtr m1 = SimpleTexturedMaterial::create();	     
	// when everything is changed, not setting the mask is ok
	beginEditCP(m1);
	{
		m1->setAmbient      (Color3f(0.3,0.3,0.5));
		m1->setDiffuse      (Color3f(0.8,0.8,0.8));
		m1->setEmission     (Color3f(0.0,0.0,0.0));
		m1->setSpecular     (Color3f(1.0,1.0,1.0));
		m1->setShininess    (20);
		m1->setTransparency (0);
		m1->setColorMaterial(GL_NONE);
		
		m1->setImage	 (image);
		m1->setMinFilter    (GL_LINEAR_MIPMAP_LINEAR);
		m1->setMagFilter    (GL_LINEAR);
		m1->setEnvMode      (GL_MODULATE);
	}
	endEditCP (m1);
	
	
	// Zusammenfuegen der Eigenschaften
	GeometryPtr frontGeo=Geometry::create();
	beginEditCP (frontGeo, Geometry::TypesFieldMask    |
			 Geometry::LengthsFieldMask   |
			 Geometry::IndicesFieldMask   |
			 Geometry::PositionsFieldMask |
			 Geometry::NormalsFieldMask   |
			 Geometry::MaterialFieldMask  );
	{
		frontGeo->setTypes    (frontType);
		frontGeo->setLengths  (frontLens);
		frontGeo->setIndices  (frontIndices);
		frontGeo->setTexCoords(frontTex);
		frontGeo->setPositions(frontPnts);
		frontGeo->setNormals  (frontNorms);
		frontGeo->setMaterial (m1);
	}
	endEditCP (frontGeo, Geometry::TypesFieldMask    |
			 Geometry::LengthsFieldMask   |
			 Geometry::IndicesFieldMask   |
			 Geometry::PositionsFieldMask |
			 Geometry::NormalsFieldMask   |
			 Geometry::MaterialFieldMask  );

	
	
	
	
	// Erstellen eines Knotens
	NodePtr front = Node::create();
	beginEditCP(front, Node::CoreFieldMask);
	{
		front->setCore(frontGeo);
	}
	endEditCP (front, Node::CoreFieldMask);
#endif
	
	setName(front, "room2Front");
	
	
	// *********** Back ***********
	NodePtr back = makePlane(room2_width, room2_height, 50, 50);
	setName(back, "room2Back");
	
	TransformPtr tback = Transform::create();
	beginEditCP(tback, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width/2, room2_height/2, 0);
		tback->setMatrix(m);
	endEditCP(tback, Transform::MatrixFieldMask);
	
	NodePtr backTrans = Node::create();
	beginEditCP(backTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		backTrans->setCore(tback);
		backTrans->addChild(back);
	endEditCP(backTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	
	// *********** Right ***********
	NodePtr right = makePlane(room2_depth, room2_height, 50, 50);
	setName(right, "room2Right");
	
	TransformPtr tright = Transform::create();
	beginEditCP(tright, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width, room2_height/2, room2_depth/2);
		m.setRotate(Quaternion(Vec3f(0,1,0), -M_PI/2));
		tright->setMatrix(m);
	endEditCP(tright, Transform::MatrixFieldMask);
	
	NodePtr rightTrans = Node::create();
	beginEditCP(rightTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		rightTrans->setCore(tright);
		rightTrans->addChild(right);
	endEditCP(rightTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	
	// *********** Left ***********
	NodePtr left = makePlane(room2_depth, room2_height, 50, 50);
	setName(left, "room2Left");
	
	TransformPtr tleft = Transform::create();
	beginEditCP(tleft, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(0, room2_height/2, room2_depth/2);
		m.setRotate(Quaternion(Vec3f(0,1,0), M_PI/2));
		tleft->setMatrix(m);
	endEditCP(tleft, Transform::MatrixFieldMask);
	
	NodePtr leftTrans = Node::create();
	beginEditCP(leftTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		leftTrans->setCore(tleft);
		leftTrans->addChild(left);
	endEditCP(leftTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	
	// *********** Roof ***********
	NodePtr roof = makePlane(room2_width, room2_depth, 50, 50);
	setName(roof, "room2Roof");
	
	TransformPtr troof = Transform::create();
	beginEditCP(troof, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width/2, room2_height, room2_depth/2);
		m.setRotate(Quaternion(Vec3f(1,0,0), M_PI/2));
		troof->setMatrix(m);
	endEditCP(troof, Transform::MatrixFieldMask);
	
	NodePtr roofTrans = Node::create();
	beginEditCP(roofTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		roofTrans->setCore(troof);
		roofTrans->addChild(roof);
	endEditCP(roofTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);

	
	
	
	
	
	
	//Kammer Boden Texturen laden
	ImagePtr cryptWallImage = Image::create();
   cryptWallImage->read("materials/cryptWall.jpg");    
	    
	    
	//Aus dem Bild eine Textur machen
	TextureChunkPtr cryptWallTex = TextureChunk::create();
	beginEditCP(cryptWallTex);
		cryptWallTex->setImage(cryptWallImage);
		cryptWallTex->setMinFilter(GL_LINEAR);
		cryptWallTex->setMagFilter(GL_LINEAR);
		cryptWallTex->setWrapS(GL_REPEAT);
		cryptWallTex->setWrapT(GL_REPEAT);
		cryptWallTex->setEnvMode(GL_MODULATE);
	endEditCP(cryptWallTex);
	  
	SimpleMaterialPtr cryptWallMat = SimpleMaterial::create();
	beginEditCP(cryptWallMat);
		//Materialfarbe bei seitlicher Ansicht (Brechungswinkel)
		cryptWallMat->setAmbient(Color3f(0.3, 0.3, 0.5));    
		//Bestimmt Farbe des Materials
		cryptWallMat->setDiffuse(Color3f(1.0, 1.0, 1.0));
		cryptWallMat->setSpecular(Color3f(0.1, 0.1, 0.2));
		cryptWallMat->addChunk(cryptWallTex);
	endEditCP(cryptWallMat);


	
	GeometryPtr cryptWallGeo = GeometryPtr::dcast(back->getCore());
	beginEditCP(cryptWallGeo);
		cryptWallGeo->setMaterial(cryptWallMat);
	endEditCP(cryptWallGeo);
	
	cryptWallGeo = GeometryPtr::dcast(right->getCore());
	beginEditCP(cryptWallGeo);
		cryptWallGeo->setMaterial(cryptWallMat);
	endEditCP(cryptWallGeo);
	
	cryptWallGeo = GeometryPtr::dcast(left->getCore());
	beginEditCP(cryptWallGeo);
		cryptWallGeo->setMaterial(cryptWallMat);
	endEditCP(cryptWallGeo);
	
	cryptWallGeo = GeometryPtr::dcast(roof->getCore());
	beginEditCP(cryptWallGeo);
		cryptWallGeo->setMaterial(cryptWallMat);
	endEditCP(cryptWallGeo);

	
	
	
	
	// *********** Bottom ***********
	//NodePtr bottom = makeBox(room2_width, 10, room2_depth, 10, 10, 10);
	NodePtr bottom = makePlane(room2_width, room2_depth, 50, 50);
	setName(bottom, "room2Bottom");
	
	TransformPtr tbottom = Transform::create();
	beginEditCP(tbottom, Transform::MatrixFieldMask);
		m.setIdentity();
		m.setTranslate(room2_width/2, 0, room2_depth/2);
		m.setRotate(Quaternion(Vec3f(1,0,0), -M_PI/2));
		tbottom->setMatrix(m);
	endEditCP(tbottom, Transform::MatrixFieldMask);
	
	NodePtr bottomTrans = Node::create();
	beginEditCP(bottomTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
		bottomTrans->setCore(tbottom);
		bottomTrans->addChild(bottom);
	endEditCP(bottomTrans, Node::CoreFieldMask | Node::ChildrenFieldMask);
	
	
	//Kammer Boden Texturen laden
	ImagePtr cryptBottomImage = Image::create();
   cryptBottomImage->read("materials/cryptBottom.jpg");	 
	
	//Aus dem Bild eine Textur machen
	TextureChunkPtr cryptBottomTex = TextureChunk::create();
	beginEditCP(cryptBottomTex);
		cryptBottomTex->setImage(cryptBottomImage);
		cryptBottomTex->setMinFilter(GL_LINEAR);
		cryptBottomTex->setMagFilter(GL_LINEAR);
		cryptBottomTex->setWrapS(GL_REPEAT);
		cryptBottomTex->setWrapT(GL_REPEAT);
		cryptBottomTex->setScale(0.2);
		cryptBottomTex->setEnvMode(GL_MODULATE);
	endEditCP(cryptBottomTex);
	  
	SimpleMaterialPtr cryptBottomMat = SimpleMaterial::create();
	beginEditCP(cryptBottomMat);
		//Materialfarbe bei seitlicher Ansicht (Brechungswinkel)
		cryptBottomMat->setAmbient(Color3f(0.3, 0.3, 0.5));    
		//Bestimmt Farbe des Materials
		cryptBottomMat->setDiffuse(Color3f(1.0, 1.0, 1.0));
		cryptBottomMat->setSpecular(Color3f(0.1, 0.1, 0.2));
		cryptBottomMat->addChunk(cryptBottomTex);
	endEditCP(cryptBottomMat);

	//Mittelpunkt des Texturtraegers heraus finden und die Textur darauf legen.
	GeometryPtr cryptBottomGeo = GeometryPtr::dcast(bottom->getCore());
	beginEditCP(cryptBottomGeo);
		cryptBottomGeo->setMaterial(cryptBottomMat);
	endEditCP(cryptBottomGeo);
	
	
	
	
	
	
	// Erstellen eines Knotens
	NodePtr holeRoom2 = Node::create();
	beginEditCP(holeRoom2, Node::CoreFieldMask);
	{
		holeRoom2->setCore(Group::create());
		holeRoom2->addChild(backTrans);
		holeRoom2->addChild(rightTrans);
		holeRoom2->addChild(leftTrans);
		holeRoom2->addChild(roofTrans);
		holeRoom2->addChild(bottomTrans);
		
#ifdef ROOM2_PLANES_ON
		holeRoom2->addChild(frontTrans);
#else
		holeRoom2->addChild(front);
#endif
	}
	endEditCP  (holeRoom2, Node::CoreFieldMask);
	
	
	return holeRoom2;
}
